package com.jtpay.sdk.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.jtpay.sdk.R;

import java.util.List;

import apiUtils.models.PayAppInfo;


/**
 * Created by Administrator on 2017/8/22.
 */

public class AppInfoAdapter extends BaseAdapter {
    private List<PayAppInfo> mPayAppInfos;
    private Context mContext;

    public AppInfoAdapter(List<PayAppInfo> payAppInfos, Context context) {
        mPayAppInfos = payAppInfos;
        mContext = context;
    }

    @Override
    public int getCount() {
        return mPayAppInfos.size();
    }

    @Override
    public Object getItem(int position) {
        return mPayAppInfos.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        TextView mAppNametv;
        LayoutInflater layoutInflater = LayoutInflater.from(mContext);
        convertView = layoutInflater.inflate(R.layout.platform_name, null);
        mAppNametv = (TextView) convertView.findViewById(R.id.name);
        mAppNametv.setText(mPayAppInfos.get(position).getAppName());
        return convertView;
    }
}
